winsafe\ole\com_interfaces/ipersist.rs
1#![allow(non_camel_case_types, non_snake_case)]
2
3use crate::co;
4use crate::decl::*;
5use crate::kernel::privs::*;
6use crate::ole::{privs::*, vts::*};
7use crate::prelude::*;
8
9com_interface! { IPersist: "0000010c-0000-0000-c000-000000000046";
10 /// [`IPersist`](https://learn.microsoft.com/en-us/windows/win32/api/objidl/nn-objidl-ipersist)
11 /// COM interface.
12 ///
13 /// Automatically calls
14 /// [`Release`](https://learn.microsoft.com/en-us/windows/win32/api/unknwn/nf-unknwn-iunknown-release)
15 /// when the object goes out of scope.
16}
17
18impl ole_IPersist for IPersist {}
19
20/// This trait is enabled with the `ole` feature, and provides methods for
21/// [`IPersist`](crate::IPersist).
22///
23/// Prefer importing this trait through the prelude:
24///
25/// ```no_run
26/// use winsafe::prelude::*;
27/// ```
28pub trait ole_IPersist: ole_IUnknown {
29 /// [`IPersist::GetClassID`](https://learn.microsoft.com/en-us/windows/win32/api/objidl/nf-objidl-ipersist-getclassid)
30 /// method.
31 #[must_use]
32 fn GetClassID(&self) -> HrResult<co::CLSID> {
33 let mut clsid = co::CLSID::default();
34 ok_to_hrresult(unsafe {
35 (vt::<IPersistVT>(self).GetClassID)(self.ptr(), pvoid(&mut clsid))
36 })
37 .map(|_| clsid)
38 }
39}